---
kind: ConfigMap
apiVersion: v1
metadata:
  name: proxy
  namespace: dragonfly-e2e
data:
  dfget.yaml: |-
    aliveTime: 0s
    gcInterval: 1m0s
    keepStorage: true
    verbose: true
    pprof-port: 9999
    scheduler:
      manager:
        enable: true
        netAddrs:
        - type: tcp
          addr: dragonfly-manager.dragonfly-system.svc.cluster.local:65003
        refreshInterval: 5m
      scheduleTimeout: 30s
      disableAutoBackSource: true
    download:
      prefetch: true
      calculateDigest: true
      downloadGRPC:
        security:
          insecure: true
      peerGRPC:
        security:
          insecure: true
        tcpListen:
          listen: 0.0.0.0
          port: 65000
      perPeerRateLimit: 512Mi
      totalRateLimit: 1024Mi
      trafficShaperType: sampling
      concurrent:
        thresholdSize: 10M
        thresholdSpeed: 2M
        goroutineCount: 4
    upload:
      rateLimit: 1024Mi
      security:
        insecure: true
      tcpListen:
        listen: 0.0.0.0
        port: 65002
    storage:
      diskGCThreshold: 50Gi
      multiplex: true
      strategy: io.d7y.storage.v2.simple
      taskExpireTime: 6h
    proxy:
      defaultFilter: Expires&Signature&ns
      tcpListen:
        listen: 0.0.0.0
        port: 65001
      security:
        insecure: true
      registryMirror:
        dynamic: true
        insecure: false
        url: https://index.docker.io
      proxies:
      - regx: blobs/sha256.*
      - regx: file-server

---

apiVersion: v1
kind: Service
metadata:
  name: proxy
  namespace: dragonfly-e2e
spec:
  selector:
    app: dragonfly
    component: proxy
  type: ClusterIP
  ports:
  - name: proxy
    port: 65001
    protocol: TCP
    targetPort: 65001

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: proxy
  namespace: dragonfly-e2e
spec:
  serviceName: proxy
  selector:
    matchLabels:
      app: dragonfly
      component: proxy
  replicas: 3
  template:
    metadata:
      labels:
        app: dragonfly
        component: proxy
    spec:
      containers:
      - name: proxy
        image: d7yio/dfdaemon:latest
        imagePullPolicy: "IfNotPresent"
        ports:
        - containerPort: 65001
        volumeMounts:
        - mountPath: /etc/dragonfly
          name: config
        - mountPath: /var/log/dragonfly/
          name: logs
        - mountPath: /var/lib/dragonfly/
          name: data
        - mountPath: /tmp/artifact
          name: artifact
      volumes:
      - name: config
        configMap:
          name: proxy
          defaultMode: 420
      - name: data
        emptyDir: { }
      - name: logs
        emptyDir: { }
      - name: artifact
        hostPath:
          path: /tmp/artifact
